library(quantmod)
library(tidyquant)
library(ggplot2)
library(xts)
library(zoo)
library(plotly)
library(tidyr)
library(dplyr)
rm(list=ls())
##Extracting the data
data("EuStockMarkets")
###Code
stocks <- as.data.frame(EuStockMarkets) %>%
gather(index, price) %>%
mutate(time = rep(time(EuStockMarkets), 4))
##Plot a graph using above data
plot_ly(stocks, z = ~time, y = ~price, color = ~index, mode = "lines") -> plot
style(plot, hoveron = "points", hoverinfo = "z+y+text", hoverlabel = list(bgcolor = "white"))